// 引入react
import * as React from 'react';
import {StyleSheet, View, Text, ScrollView, TextInput} from 'react-native';

import {HeaderTitle} from '../../../../../componet/settingComponent/HeaderTitle';
import {SafeAreaView} from 'react-native-safe-area-context';
import AllStyle from '../../../../../style';
import {BottomButton} from '../../../../../componet/settingComponent/BottomButton';

/**
 * @Description:
 * @author TangYong
 * @date 2023/3/13
 */
export class SetUserName extends React.Component {
    constructor(props) {
        super(props);
        this.state = {};
    }

    //生命周期：组件挂载后
    componentDidMount() {

    }

    //方法
    onChangeName(text) {
        this.setState({
            Name: text,
        });
    }

    //方法
    back = () => {
        const route = {

            name: this.props.route.params.routePathName,
            params: {
                Name: this.state.Name,
            },
        };
        this.props.navigation.navigate(route);
    };
    save = () => {

    };

    //DOM
    render() {
        return (
            <SafeAreaView edges={['top', 'left', 'right', 'bottom']} style={{flex: 1, backgroundColor: '#FFF'}}>
                <View style={AllStyle.container}>
                    <HeaderTitle goBack={() => this.back()} headtitle={this.props.route.params.title}></HeaderTitle>
                    <ScrollView style={{paddingTop: 15}}>
                        <TextInput
                            style={{
                                textAlign: 'left',
                                borderColor: 'transparent',
                                backgroundColor: '#fff',
                                borderWidth: 1,
                                padding: 15,
                                fontSize: 16,
                            }}
                            maxLength={4}
                            placeholder='请输入姓名'
                            secureTextEntry={false}
                            onChangeText={text => this.onChangeName(text)}
                            value={this.state.Name}
                        />
                    </ScrollView>
                </View>

                <BottomButton click={() => this.save()} title='保存'></BottomButton>
            </SafeAreaView>
        );
    }

}

const style = StyleSheet.create({
    //样式
});

